//package com.yunhe.option.controller.base;
//
//import com.yunhe.common.exception.ArgumentErrorException;
//import com.yunhe.common.exception.ObjectNotFoundException;
//import com.yunhe.common.exception.UniqueConstraintsException;
//import com.yunhe.common.model.DomainList;
//import com.yunhe.common.model.ResultObject;
//import com.yunhe.option.domain.base.Area;
//import com.yunhe.option.domain.base.EstablishSoundManagementLedger;
//import com.yunhe.option.service.base.EstablishSoundManagementLedgerService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiImplicitParams;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.Optional;
//
///**
// * @ClassName EstablishSoundManagementLedger
// * @Description 管理台账建立健全类型维护
// * @Author HeTao
// * @Date 2020/11/3 13:48
// * @Version 1.0
// **/
//@Api(value = "establishSoundManagementLedger", description = "管理台账建立健全类型维护", tags = {"Base_EstablishSoundManagementLedger"})
//@RestController
//@RequestMapping("/establishSoundManagementLedger")
//public class EstablishSoundManagementLedgerController {
//
//    @Autowired
//    private EstablishSoundManagementLedgerService establishSoundManagementLedgerService;
//    /**
//     * 新增管理台账建立健全类型
//     * @param establishSoundManagementLedger 管理台账建立健全类型对象
//     */
//    @ApiOperation("新增管理台账建立健全类型")
//    @RequestMapping(method = RequestMethod.POST)
//    public ResponseEntity<ResultObject> post(@RequestBody EstablishSoundManagementLedger establishSoundManagementLedger)
//            throws ArgumentErrorException, UniqueConstraintsException, ObjectNotFoundException {
//        EstablishSoundManagementLedger newEstablishSoundManagementLedger = establishSoundManagementLedgerService.createEstablishSoundManagementLedger(establishSoundManagementLedger);
//        return new ResponseEntity<>(new ResultObject<>(newEstablishSoundManagementLedger), HttpStatus.OK);
//    }
//
//    /**
//     * 根据ID删除管理台账建立健全类型
//     *
//     * @param id id
//     */
//    @ApiOperation("根据ID删除管理台账建立健全类型")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "id", value = "管理台账建立健全类型ID", required = true, dataType = "long", paramType = "path")
//    })
//    @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
//    public ResponseEntity<ResultObject> delete(@PathVariable("id") Long id) {
//        establishSoundManagementLedgerService.deleteById(id);
//        return new ResponseEntity<>(new ResultObject<>(null), HttpStatus.OK);
//    }
//
//    /**
//     * 更新管理台账建立健全类型（更新全部字段）
//     *
//     * @param id   ID
//     * @param establishSoundManagementLedger 管理台账建立健全类型对象
//     */
//    @ApiOperation("更新管理台账建立健全类型（更新全部字段）")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "long", paramType = "path")
//    })
//    @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
//    public ResponseEntity<ResultObject> put(@PathVariable("id") Long id,
//                                            @RequestBody EstablishSoundManagementLedger establishSoundManagementLedger)
//            throws ArgumentErrorException, UniqueConstraintsException, ObjectNotFoundException {
//        establishSoundManagementLedger.setId(id);
//        EstablishSoundManagementLedger newEstablishSoundManagementLedger = establishSoundManagementLedgerService.updateEstablishSoundManagementLedger(establishSoundManagementLedger);
//        return new ResponseEntity<>(new ResultObject<>(newEstablishSoundManagementLedger), HttpStatus.OK);
//    }
//
//    /**
//     * 更新管理台账建立健全类型
//     * @param id 管理台账建立健全类型ID
//     * @param code 管理台账建立健全类型代码
//     * @param name 管理台账建立健全类型编号
//     * @param title 管理台账建立健全类型名称
//     * @param sn 排序序号
//     * @param activity 是否可用
//     */
//    @ApiOperation("更新设备类型")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "id", value = "管理台账建立健全类型ID", required = true, dataType = "long", paramType = "path"),
//            @ApiImplicitParam(name = "code", value = "管理台账建立健全类型代码", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "name", value = "管理台账建立健全类型编号", dataType = "string", paramType = "query"),
//            @ApiImplicitParam(name = "title", value = "管理台账建立健全类型名称", dataType = "string", paramType = "query"),
//            @ApiImplicitParam(name = "sn", value = "排序序号", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "activity", value = "是否可用", dataType = "boolean", paramType = "query")
//    })
//    @RequestMapping(value = "/{id}", method = RequestMethod.PATCH)
//    public ResponseEntity<ResultObject> patch(
//            @PathVariable("id") Long id,
//            @RequestParam("code") Optional<Long> code,
//            @RequestParam("name") Optional<String> name,
//            @RequestParam("title") Optional<String> title,
//            @RequestParam("sn") Optional<Long> sn,
//            @RequestParam("activity") Optional<Boolean> activity)
//            throws ArgumentErrorException, ObjectNotFoundException, UniqueConstraintsException {
//        EstablishSoundManagementLedger newEstablishSoundManagementLedger =  establishSoundManagementLedgerService.updateEstablishSoundManagementLedger(id, code.orElse(null), name.orElse(null), title.orElse(null), sn.orElse(null), activity.orElse(null));
//        return new ResponseEntity<>(new ResultObject<>(newEstablishSoundManagementLedger), HttpStatus.OK);
//    }
//
//    /**
//     * 根据条件获得管理台账建立健全类型列表
//     */
//    @ApiOperation("根据条件获得管理台账建立健全类型列表")
//    @RequestMapping(method = RequestMethod.GET)
//    public ResponseEntity<ResultObject> search() {
//        Iterable<EstablishSoundManagementLedger> results = establishSoundManagementLedgerService.findEstablishSoundManagementLedgers();
//        return new ResponseEntity<>(new ResultObject<>(results), HttpStatus.OK);
//    }
//}
